import type { flist, User } from '@/types/user'
import { request } from '@/utils/request'

//获取用户信息接口
export const login = (useobj: User) =>
  request<any>('/user/login', 'POST', useobj)

//获取组件token接口
export const getToken = () => request<any>('/token/getToken', 'GET')
//组件应用
export const getComtoken = () => request<any>('/app/list', 'GET')
//增加缓存操作
export const setCache = () => request<any>('/init', 'GET')
// 获取新闻列表
export const getNewsList = (feobj: any) =>
  request<any>('/news/list', 'GET', feobj)
//获取常用服务
export const getCommonService = (obj: any) =>
  request<any>('/app/listused', 'GET', obj)
//获取推荐服务
export const getRecommendService = (obj: any) =>
  request<any>('/app/listrec', 'GET', obj)
//记录访问
export const recordVisit = (obj: any) =>
  request<any>('/monitor/add', 'POST', obj)
//最近使用和访问记录
export const getRecentVisit = (obj: any) =>
  request<any>('/app/listrecord', 'GET', obj)
//提问
export const askQuestion = (obj: any) =>
  request<any>('/consult/add', 'POST', obj)
//获取咨询记录
export const getFeedback = (obj: any) =>
  request<any>('/consult/list', 'GET', obj)
//获取公告图片
export const getNoticeImg = (obj: any) =>
  request<any>('/recommend/list', 'GET', obj)
//搜索应用
export const searchApp = (obj: any) => request<any>('/app/search', 'GET', obj)
//系统信息
export const getSystemInfo = () => request<any>('/recommend/getSysinfo', 'GET')
//首页公告
export const getNotice = () => request<any>('/recommend/getNotice', 'GET')
//首页学校简历和专业
export const getSchoolInfo = () =>
  request<any>('/recommend/getSchoolinfo', 'GET')
//应用分类
export const getAppCategory = () => request<flist>('/course/listCat', 'GET')
//课程列表
export const getCourseList = (params: any) =>
  request<any>('/course/list', 'GET', params)
//最近使用记录
export const getRecentUse = (obj: any) =>
  request<any>('/course/listrecord', 'GET', obj)
//获取课程详情
export const getCourseDetail = (id: any) => request<any>(`/course/${id}`, 'GET')
//获取使用指南
export const getGuide = () => request<any>('/recommend/getHelp', 'GET')
